<?php 
namespace app\api\model;

use libraries\BaseModel;
use think\Db;

/**
 * 邮箱模型
 */
class Email extends BaseModel
{
	protected static $self_table = 'web_email';
    /**
     * [saveEmailData 保存邮件的发送记录]
     * @Author QiaoWeiWei
     * @Date   2019-12-27
     * @param  string     $email   [收件人]
     * @param  string     $scene   [邮件场景]
     * @param  string     $status  [发送状态：1成功，2失败]
     * @param  string     $remark  [备注]
     * @param  string     $codes    [验证码]
     * @return [type]              [description]
     */
    static function saveEmailData(string $email,string $scene, int $status,string $remark = '', string $codes = ''){
        if(empty($email) || empty($scene) || empty($status)){
            return false;
        }
        $data = [
            'email' => $email,
            // 'content' => $content,
            'scene' => $scene,
            'status' => $status,
            'remark' => $remark,
            'codes' => $codes,
        ];
        $res = Db::table(self::$self_table)->insert($data);

        return $res;
    }
}